<?php
/**
 * User:chendenan
 * Created On 2022/3/10 0010 23:25
 */

namespace app\api\controller;

use app\common\business\{Goods as GoodsBus,Category as CategoryBus};
use app\common\lib\Show as ShowLib;

class Index extends  ApiBase {
    /**
     * 获取首页栏目推荐商品
     * @return \think\response\Json
     */
    public function getRotationChart(){
        $result = (new GoodsBus())->getRotationChart();
        return ShowLib::success($result);
    }
    public function categoryGoodsRecommend(){
        $categoryIdsResult = (new CategoryBus())->getByPid();
        $categoryIds = array_column($categoryIdsResult,"id");
        $result = (new GoodsBus())->categoryGoodsRecommend($categoryIds);
        return ShowLib::success($result);
    }
}